<template>
	<view class="pro_cont_rt_ct">
		<!-- 轮播图 -->
		<view class="swiperImg">
			<swiper
			  :autoplay="false"
			  @change="changeSwiper"
			  :current="currentIndex"
			  class="sw"
			>
			  <swiper-item v-for="(item, index) in dataList" :key="item.id">
				<view :id="'content-wrap' + index" class="contimg">
					<image :src="item.url" mode="widthFix"></image>
				</view>
			  </swiper-item>
			</swiper>
		</view>
		<!-- 产品列表 -->
		<view class="btns">
			<view class="choose" @tap="changeTab(1)">
				<view class="lt" :class="tabIndex==1?'active':''">
					综合
				</view>
			</view>
			<view class="choose" @tap="changeTab(2)">
				<view class="lt" :class="tabIndex==2?'active':''">销量</view>
				<view class="rt">
					<!-- arrow-up-fill 上   arrow-down-fill下 -->
					<u-icon name="arrow-up-fill" :color="status == true && tabIndex==2 ?'#16843F':'#D8D8D8'" size="3" class="shang"></u-icon>
					<u-icon name="arrow-down-fill" :color="status == false && tabIndex==2 ?'#16843F':'#D8D8D8'" size="3"></u-icon>
				</view>
			</view>
			<view class="choose" @tap="changeTab(3)">
				<view class="lt" :class="tabIndex==3?'active':''">价格</view>
				<view class="rt">
					<!-- arrow-up-fill 上   arrow-down-fill下 -->
					<u-icon name="arrow-up-fill" :color="status == true && tabIndex==3 ?'#16843F':'#D8D8D8'" size="3" class="shang"></u-icon>
					<u-icon name="arrow-down-fill" :color="status == false && tabIndex==3 ?'#16843F':'#D8D8D8'" size="3"></u-icon>
				</view>
			</view>
		</view>
		
		<scroll-view :scroll-top="scrollTop2" scroll-y="true" class="scroll-Y2"  @scroll="scroll2">
			<view class="pro" v-for="(item,index) in proDatas" :key="index">
				<view class="img">
					<image :src="item.images" mode="widthFix"></image>
					<text v-show="item.limit == 0">限</text>
				</view>
				<view class="cont">
					<view class="tile">
						<text class="stats" v-if="item.limit == 0">限时</text>
						<text class="stats bg16" v-if="item.limit == 1">时令</text>
						<text class="font27">{{item.title}}</text>
					</view>
					<view class="font19">{{item.conction}}</view>
					<view class="hd">
						<view class="xian">
							<text>一件8折</text><text>满100减20</text>
						</view>
					</view>
					<view class="gwc">
						<view class="lt">
							<view class="newPrice">
								<text>¥</text>
								<text>{{item.newPrice}}</text>
							</view>
							<view class="oldPrice">
								<text>¥{{item.newPrice}}</text>
							</view>
						</view>
						<view class="rt">
							<image src="@/static/images/mall_ico_tianjia@2x.png" mode="widthFix"></image>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>

	</view>
</template>

<script>
	export default {
		name:"proContRt",
		props:{
			dataList:{
				type:Array,
				default:[]
			},
			proDatas:{
				type:Array,
				default:[]
			}
		},
		data() {
			return {
				scrollTop2:0,
				old: {
					scrollTop2: 0
				},
				currentIndex:0,
				status:true,
				tabIndex:1
			};
		},
		methods:{
			changeTab(num){
				this.tabIndex = num;
				this.status = !this.status
			},
			scroll2: function(e) {
				console.log(e)
				this.old.scrollTop2 = e.detail.scrollTop
			}
		}
	}
</script>

<style lang="scss">
.pro_cont_rt .scroll-Y2{
	height: 500px;
}	
.pro{
	display: flex;
	border-bottom: 2rpx solid #F0F0F0;
	padding: 20rpx 0;
	.img{
		width: 200rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		position: relative;
		image{
			width: 180rpx;
		}
		text{
			position: absolute;
			color: #FFFFFF;
			font-size: 23rpx;
			width: 46rpx;
			height: 38rpx;
			line-height: 38rpx;
			background: linear-gradient(141deg, #FD8F43 0%, #F95620 100%);
			border-radius: 15rpx 0rpx 15rpx 0rpx;
			text-align: center;
			top: 0;
			left: 0;
		}
	}
	.cont{
		width: calc(100% - 200rpx);
		.tile{
			.stats{
				color: #FFFFFF;
				font-size: 15rpx;
				background: linear-gradient(141deg, #FD8F43 0%, #F95620 100%);
				border-radius: 4rpx;
				padding: 3rpx 10rpx;
				margin-right: 10rpx;
				&.bg16{
					background: linear-gradient(141deg, #58CA82 0%, #18AE50 100%)
				}
			}
			.font27{
				color: #252525;
				font-size: 27rpx;
				font-weight: bold;
			}
		}
		.font19{
			color: #666666;
			font-size: 19rpx;
			margin: 10rpx 0;
		}
		.hd{
			.xian{
				display: flex;
				align-items: center;
				border: 1px solid #FF2000;
				display: inline-block;
				border-radius: 8rpx;
				line-height: 1;
				padding: 3rpx 0 6rpx;
				text{
					padding: 0rpx 10rpx;
					color: #FF2000;
					font-size: 16rpx;
					display: inline-block;
					&:last-child{
						border-left: 1px solid #FF2000;
					}
				}
			}
		}
		.gwc{
			display: flex;
			justify-content: space-between;
			margin-top: 12rpx;
			.lt{
				display: flex;
				align-items: baseline;
				.newPrice{
					text:first-child{
						color: #F95620;
						font-size: 19rpx;
					}
					text:last-child{
						color: #F95620;
						font-size: 35rpx;
						font-weight: bold;
					}
				}
				.oldPrice{
					color: #999999;
					font-size: 15rpx;
					margin-left: 12rpx;
				}
			}
		}
		.rt{
			image{
				width: 46rpx;
			}
		}
	}
}	
.pro_cont_rt_ct{
	padding: 0 20rpx 20rpx;
	.swiperImg{
		overflow: hidden;
		border-radius: 10rpx;
	}
	.btns{
		display: flex;
		align-items: center;
		justify-content: flex-end;
		.choose{
			display: flex;
			align-items: center;
			color: #222222;
			font-size: 23rpx;
			margin-left: 50rpx;
			&:first-child{
				margin-left: 0;
			}
			.lt{
				margin-right: 1px;
				font-weight: bold;
				position: relative;
				top: 2px;
				&.active{
					color: #16843F;
				}
			}
			.shang{
				margin-bottom: 2px;
				display: inline-block;
			}
			
		}
	}
}
</style>